package org.scilab.forge.jlatexmath.util;

/**
 * Created by Administrator on 2017-3-4.
 */
public class CoderUtil {
    private CoderUtil() {
    }

    /**
     * Base64编码
     *
     * @param binaryData
     * @return
     * @throws Exception
     */
    public static String encodeBase64(byte[] binaryData) throws Exception {
        return new String(org.apache.commons.codec.binary.Base64.encodeBase64(binaryData), "UTF-8");
    }

    /**
     * Base64解码
     *
     * @param base64String
     * @return
     * @throws Exception
     */
    public static byte[] decodeBase64(String base64String) throws Exception {
        return org.apache.commons.codec.binary.Base64.decodeBase64(base64String.getBytes("UTF-8"));
    }
}
